home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWSemEvt / FWDscOpr.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.5 KB  |  172 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWDscOpr.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWDSCOPR_H
  11. #include "FWDscOpr.h"
  12. #endif
  13.  
  14. #ifndef FWDESC_H
  15. #include "FWDesc.h"
  16. #endif
  17.  
  18. #ifndef FWSCPTBL_H
  19. #include "FWScptbl.h"
  20. #endif
  21.  
  22. //========================================================================================
  23. //    Runtime Information
  24. //========================================================================================
  25.  
  26. #ifdef FW_BUILD_MAC    
  27. #pragma segment fwsemevt2
  28. #endif
  29.  
  30. //---------------------------------------------------------------------------------------
  31. //    operator FW_CDesc& << FW_CDesc&
  32. //---------------------------------------------------------------------------------------
  33.  
  34. FW_CDesc& operator<< (FW_CDesc& desc, const FW_CDesc& other)
  35. {
  36.     desc.PutDataByDesc(other);
  37.     return desc;
  38. }
  39.  
  40. //---------------------------------------------------------------------------------------
  41. //    operator FW_CDesc& >> FW_CDesc&
  42. //---------------------------------------------------------------------------------------
  43.  
  44. const FW_CDesc& operator>> (const FW_CDesc& desc, FW_CDesc& other)
  45. {
  46.     other = desc;
  47.     return desc;
  48. }
  49.  
  50. //---------------------------------------------------------------------------------------
  51. //    operator FW_CDesc& << ODDescType&
  52. //---------------------------------------------------------------------------------------
  53.  
  54. FW_CDesc& operator<< (FW_CDesc& desc, ODDescType typeValue)
  55. {
  56.     desc.PutDataByPtr(typeType, &typeValue, sizeof(ODDescType));
  57.     return desc;
  58. }
  59.  
  60. //---------------------------------------------------------------------------------------
  61. //    operator FW_CDesc& >> ODDescType&
  62. //---------------------------------------------------------------------------------------
  63.  
  64. const FW_CDesc& operator>> (const FW_CDesc& desc, ODDescType& typeValue)
  65. {            
  66.     desc.GetDataByPtr(typeType, &typeValue, NULL, sizeof(ODDescType));
  67.     return desc;
  68. }
  69.  
  70. //---------------------------------------------------------------------------------------
  71. //    operator FW_CDesc& << long&
  72. //---------------------------------------------------------------------------------------
  73.  
  74. FW_CDesc& operator<< (FW_CDesc& desc, long value)
  75. {
  76.     desc.PutDataByPtr(typeLongInteger, &value, sizeof(value));
  77.     return desc;
  78. }
  79.  
  80. //---------------------------------------------------------------------------------------
  81. //    operator FW_CDesc& >> long&
  82. //---------------------------------------------------------------------------------------
  83.  
  84. const FW_CDesc& operator>> (const FW_CDesc& desc, long& value)
  85. {
  86.     desc.GetDataByPtr(typeLongInteger, &value, NULL, sizeof(value));
  87.     return desc;
  88. }
  89.  
  90. //---------------------------------------------------------------------------------------
  91. //    operator FW_CDesc& << FW_CColor&
  92. //---------------------------------------------------------------------------------------
  93.  
  94. FW_CDesc& operator<< (FW_CDesc& desc, const FW_CColor& color)
  95. {
  96.     desc.PutColor(color);
  97.     return desc;
  98. }
  99.  
  100. //---------------------------------------------------------------------------------------
  101. //    operator FW_CDesc& >> FW_CColor&
  102. //---------------------------------------------------------------------------------------
  103.  
  104. const FW_CDesc& operator>> (const FW_CDesc& desc, FW_CColor& color)
  105. {
  106.      desc.GetColor(color);
  107.      return desc;
  108. }
  109.  
  110. //---------------------------------------------------------------------------------------
  111. //    operator FW_CDesc& << FW_CPoint&
  112. //---------------------------------------------------------------------------------------
  113.  
  114. FW_CDesc& operator<< (FW_CDesc& desc, const FW_CPoint& thePoint)
  115. {
  116.     desc.PutPoint(thePoint);
  117.     return desc;
  118. }
  119.  
  120. //---------------------------------------------------------------------------------------
  121. //    operator FW_CDesc& >> FW_CPoint&
  122. //---------------------------------------------------------------------------------------
  123.  
  124. const FW_CDesc& operator>> (const FW_CDesc& desc, FW_CPoint& thePoint)
  125. {
  126.     desc.GetPoint(thePoint);
  127.     return desc;
  128. }
  129.  
  130. //---------------------------------------------------------------------------------------
  131. //    operator FW_CDesc& << FW_CRect&
  132. //---------------------------------------------------------------------------------------
  133.  
  134. FW_CDesc& operator<< (FW_CDesc& desc, const FW_CRect& rect)
  135. {
  136.     desc.PutRect(rect);
  137.     return desc;
  138. }
  139.  
  140. //---------------------------------------------------------------------------------------
  141. //    operator FW_CDesc& >> FW_CRect&
  142. //---------------------------------------------------------------------------------------
  143.  
  144. const FW_CDesc& operator>> (const FW_CDesc& desc, FW_CRect& rect)
  145. {
  146.      desc.GetRect(rect);
  147.      return desc;
  148. }
  149.  
  150.  
  151. //----------------------------------------------------------------------------------------
  152. //    FW_InsertScriptableIntoDesc
  153. //----------------------------------------------------------------------------------------
  154.  
  155. void FW_InsertScriptableIntoDesc(FW_MScriptable* scriptable, FW_CDesc& desc)
  156. {
  157.     desc.PutDataByPtr(FW_kSemanticObjectTokenType, &scriptable, sizeof(scriptable));
  158.     scriptable->AcquireScriptable();
  159. }
  160.  
  161. //----------------------------------------------------------------------------------------
  162. //    FW_ExtractScriptableFromDesc
  163. //----------------------------------------------------------------------------------------
  164.  
  165. FW_MScriptable* FW_ExtractScriptableFromDesc(const FW_CDesc& desc)
  166. {
  167.     FW_MScriptable* scriptable;
  168.     
  169.     desc.GetDataByPtr(FW_kSemanticObjectTokenType, &scriptable, NULL, sizeof(scriptable));
  170.     return scriptable;
  171. }
  172.